//图书馆管理员模块控制层，负责图书馆管理员模块前后端接口
//未进行账户登陆情况判断、未进行用户多端登陆判断
package com.xdu.spm.Librarian;


import com.xdu.spm.Librarian.Service.LoginService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.*;

@RestController
@RequestMapping(value = "/librarian")

public class LibrarianController {
    LoginService loginService = new LoginService();

    //登陆
    @RequestMapping(value = "/login",method = RequestMethod.POST)
    public Map<String,Object> Login(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        String userId = request.getParameter("user_id");
        String password = request.getParameter("password");

        map = loginService.LoginDetermine(userId,password);

        return map;
    }

    //修改密码
    @RequestMapping(value = "/changePassword",method = RequestMethod.POST)
    public Map<String,Object> ChangePassword(HttpServletRequest request){
        Map<String ,Object> map = new HashMap<>();

        String oldPassword = request.getParameter("old_password");
        String newPassword = request.getParameter("new_password");

        return map;
    }

    //退出登陆
    @RequestMapping(value = "/logout",method = RequestMethod.POST)
    public Map<String,Object> Logout(){
        Map<String,Object> map = new HashMap<>();

        return map;
    }

    //获取读者账号信息
    @RequestMapping(value = "/readerAccount")
    public Map<String,Object> ReaderAccount(){
        Map<String,Object> map = new HashMap<>();

        return map;
    }

    @RequestMapping(value = "/searchAccount",method = RequestMethod.POST)
    public Map<String,Object> SearchAccount(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        String readerAccount = request.getParameter("reader_account");
        String readerName = request.getParameter("reader_name");

        return map;
    }

    @RequestMapping(value = "/addAccount",method = RequestMethod.POST)
    public Map<String,Object> AddAccount(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        String readerTel = request.getParameter("reader_tel");
        String readerName = request.getParameter("reader_name");

        return map;
    }

    @RequestMapping(value = "/accountManage",method = RequestMethod.POST)
    public Map<String ,Object> AccountManage(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        String readerTel = request.getParameter("reader_tel");
        String operation = request.getParameter("operation");


        return map;
    }

    @RequestMapping(value = "/bookManage")
    public Map<String ,Object> BookManage(){
        Map<String,Object> map = new HashMap<>();

        return map;
    }

    @RequestMapping(value = "/searchBook",method = RequestMethod.POST)
    public Map<String,Object> SearchBook(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();
        //一堆数据
        return map;
    }

    @RequestMapping(value = "/bookOperate",method = RequestMethod.POST)
    public Map<String ,Object> BoosOperate(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        String bookID = request.getParameter("book_id");
        String operation = request.getParameter("operation");

        return map;
    }

    @RequestMapping(value = "/addBook",method = RequestMethod.POST)
    public Map<String ,Object> AddBook(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        return map;
    }

    @RequestMapping(value = "/editBook",method = RequestMethod.POST)
    public Map<String ,Object> EditBook(HttpServletRequest request){
        Map<String,Object> map = new HashMap<>();

        return map;
    }


}
